package com.training.java.core.polymorphism;

public class PolymorphismDemo {

	public static void main(String[] args) {
		//here we can use the same variable name car in super class Car but complier will take as the representation of the 
		//right hand side i.e police car.
		Car car = new RaceCar(); // so here we can change new race car into new police car, it will run for 
		//the same code for both results. this is polymorphic behavior.
		
		car.start();
		
		//car.chase(); we can not use chase method, it is in police car class but it is not in super class Car. It shows as error.
		
		car.accelerate(40);
		
		System.out.println("Current Speed =" + car.getCurrentSpeed());
	}

}
